
cc.Class({
    extends: cc.Component,

    properties: {
       
    },
    start () {
        this.NodeName = this.node.name;
        this.schedule(()=>{
            this.node.y-=10;
          },0.005)
    },
    putBulletNode:function (BulletPoolName) {
        game.pools.putNode(BulletPoolName,this.node);
    },
    onCollisionEnter: function (other, self) {
        //tag=10玩家战机
       if (other.tag == 10) {
        console.log('玩家飞机被攻击了');
       }
       switch (self.tag) {
         case 21:
           this.putBulletNode("enemyBulletPool");
           break;
         case 22:
           this.putBulletNode("bossBullet3");
           break;
         case 23:
           this.putBulletNode("bossBullet2");
           break;
         case 24:
           this.putBulletNode("bossBullet1");
           break;
         default:
           break;
       }
    },
    update (dt) {
        if (this.node.y < -game.viewHeight/2 && this.node) {
            if (this.NodeName == "enemyBullet") {
                this.putBulletNode("enemyBulletPool");
            }
            else if(this.NodeName == "Bossdaodang"){
                this.putBulletNode("bossBullet3");
            }
            else if(this.NodeName == "bossJiguangBullet"){
                this.putBulletNode("bossBullet2");
            }
            else if(this.NodeName == "bossYellowBullet"){
                this.putBulletNode("bossBullet1");
            }
        }

    },
});
